/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;

/**
 *
 * @author Minh Luc
 */
@Entity
@Table(name = "Claim", catalog = "P2PDB", schema = "dbo",uniqueConstraints={
     @UniqueConstraint(columnNames = {"BillNumber"})
})

@NamedQueries({
    @NamedQuery(name = "Claim.findAll", query = "SELECT c FROM Claim c"),
    @NamedQuery(name = "Claim.findByClaimId", query = "SELECT c FROM Claim c WHERE c.claimId = :claimId"),
    @NamedQuery(name = "Claim.findByBillNumber", query = "SELECT c FROM Claim c WHERE c.billNumber = :billNumber"),
    @NamedQuery(name = "Claim.findByClaimContent", query = "SELECT c FROM Claim c WHERE c.claimContent = :claimContent"),
    @NamedQuery(name = "Claim.findByFilePath", query = "SELECT c FROM Claim c WHERE c.filePath = :filePath"),
    @NamedQuery(name = "Claim.findByDateSend", query = "SELECT c FROM Claim c WHERE c.dateSend = :dateSend"),
    @NamedQuery(name = "Claim.findByDateProcesse", query = "SELECT c FROM Claim c WHERE c.dateProcesse = :dateProcesse"),
    @NamedQuery(name = "Claim.findByClaimMoney", query = "SELECT c FROM Claim c WHERE c.claimMoney = :claimMoney"),
    @NamedQuery(name = "Claim.findByClaimStatus", query = "SELECT c FROM Claim c WHERE c.claimStatus = :claimStatus")})
public class Claim implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ClaimId", nullable = false)
    private Integer claimId;
    @Column(name = "BillNumber", length = 50)
    private String billNumber;
    @Column(name = "ClaimContent", length = 2147483647)
    private String claimContent;
    @Column(name = "FilePath", length = 2147483647)
    private String filePath;
    @Column(name = "DateSend")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateSend;
    @Column(name = "DateProcesse")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateProcesse;
    @Column(name = "ClaimMoney", precision = 19, scale = 4)
    private BigDecimal claimMoney;
    @Column(name = "ClaimStatus", length = 20)
    private String claimStatus;
    @JoinColumn(name = "UserId", referencedColumnName = "UserId")
    @ManyToOne
    private Users users;
    @JoinColumn(name = "HospitalId", referencedColumnName = "HospitalId")
    @ManyToOne
    private Hospital hospital;
    @JoinColumn(name = "ClaimTypeId", referencedColumnName = "ClaimTypeId")
    @ManyToOne
    private ClaimType claimType;

    public Claim() {
    }

    public Claim(Integer claimId) {
        this.claimId = claimId;
    }

    public Integer getClaimId() {
        return claimId;
    }

    public void setClaimId(Integer claimId) {
        this.claimId = claimId;
    }

    public String getBillNumber() {
        return billNumber;
    }

    public void setBillNumber(String billNumber) {
        this.billNumber = billNumber;
    }

    public String getClaimContent() {
        return claimContent;
    }

    public void setClaimContent(String claimContent) {
        this.claimContent = claimContent;
    }

    public String getFilePath() {
        return filePath;
    }

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    public Date getDateSend() {
        return dateSend;
    }

    public void setDateSend(Date dateSend) {
        this.dateSend = dateSend;
    }

    public Date getDateProcesse() {
        return dateProcesse;
    }

    public void setDateProcesse(Date dateProcesse) {
        this.dateProcesse = dateProcesse;
    }

    public BigDecimal getClaimMoney() {
        return claimMoney;
    }

    public void setClaimMoney(BigDecimal claimMoney) {
        this.claimMoney = claimMoney;
    }

    public String getClaimStatus() {
        return claimStatus;
    }

    public void setClaimStatus(String claimStatus) {
        this.claimStatus = claimStatus;
    }

    public Users getUsers() {
        return users;
    }

    public void setUsers(Users users) {
        this.users = users;
    }

    public Hospital getHospital() {
        return hospital;
    }

    public void setHospital(Hospital hospital) {
        this.hospital = hospital;
    }

    public ClaimType getClaimType() {
        return claimType;
    }

    public void setClaimType(ClaimType claimType) {
        this.claimType = claimType;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (claimId != null ? claimId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Claim)) {
            return false;
        }
        Claim other = (Claim) object;
        if ((this.claimId == null && other.claimId != null) || (this.claimId != null && !this.claimId.equals(other.claimId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Claim[claimId=" + claimId + "]";
    }

}
